﻿@model Bonobo.Git.Server.Models.TeamDetailModel
@{
    ViewBag.Title = Resources.Team_Edit_Title;
}
@if (Model == null)
{    
    @Html.Partial("~/Views/Shared/_ItemNotFound.cshtml") 
}
else
{
    <text>
    <h2>@Resources.Team_Edit_Title</h2>
    @using (Html.BeginForm("Edit", "Team", FormMethod.Post, new { @class = "uniForm" }))
    {
        if (ViewBag.UpdateSuccess != null && ViewBag.UpdateSuccess)
        {
        <div id="okMsg">
            <p>@Resources.Team_Edit_UpdateSuccess</p>
        </div>
        }
        @Html.ValidationSummary(false, Resources.Team_Edit_Failure, new { @id = "errorMsg" })
        @Html.HiddenFor(m => m.Name);
        <fieldset>
            <h3>@Model.Name</h3>
            <div class="ctrlHolder"> 
              @Html.LabelFor(m => m.Description)
              @Html.TextAreaFor(m => m.Description, new { @class = "textInput medium" })
              <p class="formHint">
              </p> 
            </div> 
            <div class="ctrlHolder"> 
                @Html.LabelFor(m => m.Members)             
                @{
                    var users = (from u in ViewData["AvailableUsers"] as string[] orderby u
                                 select new SelectListItem() { Value = u, Text = u }).ToArray();
                }
            
                @Html.CheckboxListFor(m => m.Members, users, new { @class = "checkboxList medium" });             
              <p class="formHint">                  
              </p> 
            </div>
            <div class="buttonHolder"> 
                @Html.ActionLink("← " + Resources.Team_Edit_Back, "Index", null, new { @class = "secondaryAction" })
                <button type="reset" class="secondaryAction">← @Resources.Reset</button> 
                <input type="submit" value="@Resources.Account_Edit_Submit" class="primaryAction" />
            </div>
        </fieldset>
    }
    </text>
}
